package com.csx.orm.mybatisplus.entity;

import lombok.Data;

import java.util.Date;
import java.util.Objects;


@Data
public class User {

    private Long id;

    private String firstName;

    private String lastName;

    private Integer age;

    private String city;

    private Date birthday;

    private Type type;

    public static void main(String[] args) {
        Type typeA = Type.valueOf("TYPE_A");
        System.out.println(typeA);
    }


    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        User user = (User) o;
        return Objects.equals(id, user.id) && Objects.equals(firstName, user.firstName) && Objects.equals(lastName, user.lastName) && Objects.equals(age, user.age) && Objects.equals(city, user.city);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, firstName, lastName, age, city);
    }


    public enum Type {

        TYPE_A("type_a", "a");

        private final String code;
        private final String desc;

        private Type(String code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public String getCode() {
            return this.code;
        }

        public String getDesc() {
            return this.desc;
        }

    }
}